import { request } from "./request";

// 请求详情页数据
export function getDetail(iid) {
  return request({
      url: '/detail',
      params: {
        iid
      }
  })
}

export function getRecommend(){
  return request({
    url: '/recommend'

  })
}
//详情页的轮播图片和价格和优惠和购买保障
export class Goods {
  constructor(itemInfo, columns, services){
    this.title = itemInfo.title;
    this.desc = itemInfo.desc;
    this.newPrice = itemInfo.price;
    this.oldPrice = itemInfo.oldPrice;
    this.discount = itemInfo.discountDesc;
    this.columns = columns;
    this.services = services;
    this.realPrice = itemInfo.lowNowPrice
  }
}

//详情页的商家logo和销量和评价
export class Shop{
  constructor(shopInfo){
    this.logo = shopInfo.shopLogo;
    this.name = shopInfo.name;
    this.fans = shopInfo.cFans;
    this.sells = shopInfo.cSells;
    this.goodsCount = shopInfo.cGoods;
    this.score = shopInfo.score;
  }
}

//详情页的商家参数信息
export class GoodParams{
  constructor(info, rule){
    //注：image可能没有值（某些商品有值，某些没有值）
    this.image = info.image ? info.image[0] : '';
    this.infos = info.set;
    this.size= rule.tables;
  }
}

//详情页的客户评论信息
export class Ratecontent{
  constructor(rate){
    this.rate= rate
  }
}